
package acm;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	private static final int maxn = 55;
	private static final int maxm = maxn * (maxn - 1) / 2;
	static BigInteger c[][] = new BigInteger[maxn][maxn];
	static BigInteger pow2[] = new BigInteger[maxm];
	private static final BigInteger big_one = new BigInteger("1");
	private static final BigInteger big_two = new BigInteger("2");

	public static void main(String[] args) {
		init_combine();
		init_pow2();

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		for (; n > 0; n = in.nextInt()) {
			System.out.println(calc_connected(n));
		}
	}

	static BigInteger combine(int n, int m)
	{
		if (c[n][m] != null) return c[n][m];
		if (m == 0 || m == n) {
			c[n][m] = BigInteger.ONE;
			return c[n][m];
		}
		if (m == 1) {
			c[n][m] = BigInteger.valueOf(n);
			return c[n][m];
		}
		c[n][m] = combine(n - 1, m - 1).add(combine(n - 1, m));
		return c[n][m];
	}

	static void init_combine()
	{
		for (int i = 0; i < maxn; i++)
			c[i] = new BigInteger[maxn];
		for (int i = 1; i < maxn; i++)
			for (int j = 0; j <= i; j++)
				c[i][j] = combine(i, j);

	}

	static BigInteger calc_unconnected(int n)
	{
		System.out.println("unconnected: " + n);
		BigInteger sum = new BigInteger("0");
		for (int i = 1; i <= n-1; i++)
			sum = sum.add(c[n-1][i-1].multiply(pow2[(n-i)*(n-i-1)/2]).multiply(calc_connected(i)));
		return sum;
	}

	static BigInteger calc_connected(int n)
	{
		System.out.println("connected: " + n);
		if (n <= 2) return big_one;
		return pow2[n * (n-1) / 2].subtract(calc_unconnected(n));
	}

	private static void init_pow2() {
		for (int i = 0; i < maxm; i++)
			pow2[i] = BigInteger.valueOf(1);
		for (int i = 1; i < maxm; i++)
			pow2[i] = pow2[i-1].multiply(big_two);
	}
}

